<template>
	<hx-page>
		<div class='hxPage_bind'>
			<div class='hxPage_bind_row'>
				<div class="hxPage_bind_row_label">卡号</div>
				<input class='hxPage_bind_input' name='cardNo' title='卡号' type='text' placeholder='请输入卡号'
					v-model="cardNo" />
			</div>

			<div class='hxPage_bind_row'>
				<div class="hxPage_bind_row_label">证件号</div>
				<input class='hxPage_bind_input' name='certNo' title='证件号' type='text' placeholder='证件后6位数字(不含字母和括号)'
					v-model="certNo" />
			</div>
			<button class='hxButton' :disabled="this.cardNo==='' || this.certNo===''"
				@click="onSubmit">下一步</button>
		</div>

	</hx-page>
</template>

<script>
	import {HxPost} from "../../service/http";
	export default {
		name: "index",
		data() {
			return {
				cardNo: '',
				certNo: ''
			}
		},
		methods: {
			onSubmit() {
				uni.showLoading({
						title: '加载中...',
						mask: true
					})
					.then(() => {
						return HxPost('cardInfo', {
							cardId: this.cardNo,
							idcd: this.certNo
						})
					})
					.then((data) => {
						let param = Object.assign({
							idcd: this.certNo
						}, data);
						uni.hideLoading();
						uni.navigateTo({
							url: '/pages/personDetail/index?data=' + JSON.stringify(param) + '&idcd=' + this.certNo
						}).catch()
					})
					.catch((err) => {
						uni.hideLoading();
						uni.showToast({
							title: err.retMsg || '未知错误',
							icon: 'none',
							duration: 2 * 1000
						}).catch();
					})
			}
		}
	}
</script>

<style scoped lang="scss">
	.hxPage_bind {
		padding: 0 20PX;

		&_row {
			display: flex;

			&_label {
				text-align: center;
				display: inline-block;
				border-right: 1PX solid #e1e1e1;
				width: 60PX;
				margin-right: 15PX;
			}
		}

		&_input {
			margin-left: 0;
			margin-bottom: 20PX;
			padding: 8PX 0;
			border: 1PX solid #e1e1e1;
		}

		.hxButton {
			width: 100%;
		}
	}
</style>
